home *** CD-ROM | disk | FTP | other *** search
/ Ian & Stuart's Australian Mac: Not for Sale / Another.not.for.sale (Australia).iso / fade into you / getting there / WWW / MacHTTP Extras / map demo / cat_map_tr.script < prev    next >
Text File  |  1994-05-11  |  2KB  |  44 lines

  1. -- Uncomment the following "on" line if you want to compile this script as an application.
  2. -- The script should be renamed to cat_map.exe and the HTML docs should be changed accordingly
  3.  
  4. --on «event WWWΩsrch» http_search_args
  5.  
  6. -- Change the following line to be the domain name or IP address of your MacHTTP server
  7. set this_server_addr to "oac2.hsc.uth.tmc.edu"
  8.  
  9. set crlf to (ASCII character 13) & (ASCII character 10)
  10.  
  11. --this is a normal HTTP header returned when this script generates HTML for return
  12. -- to the server.
  13. set http_10_header to "HTTP/1.0 200 OK" & crlf & "Server: MacHTTP" & crlf & ¬
  14.     "MIME-Version: 1.0" & crlf & "Content-type: text/html" & crlf & crlf
  15.  
  16. --header used for URL redirects    
  17. set redirect_head to "HTTP/1.0 302 Found" & crlf & "Location: http://" & this_server_addr & "/map%20demo/"
  18.  
  19. --doc to return to on the off chance that something screws up.
  20. set parent_doc to "HTTP/1.0 302 Found" & crlf & "Location: http://" & this_server_addr & "/map%20demo/cat_map_tr.html"
  21.  
  22. if http_search_args = "" then
  23.     return parent_doc
  24. else
  25.     set comma to offset of "," in http_search_args
  26.     set theLast to count http_search_args
  27.     set x to (text 1 thru (comma - 1) of http_search_args) + 0
  28.     set y to (text (comma + 1) thru theLast of http_search_args) + 0
  29. end if
  30.  
  31. --return http_10_header & x & "," & y
  32.  
  33. if x > 8 and x < 50 and y > 60 and y < 100 then
  34.     --Got the eyes!
  35.     return http_10_header & "<title>The EYES Have it!</title><img src=dead_cat_face.gif>Got the eyes!"
  36. else
  37.     --Missed...
  38.     return http_10_header & "<title>Missed!</title><h1>You missed the eyes!</h1>"
  39. end if
  40.  
  41. --uncomment the following line if the script is saved as an application
  42. --end «event WWWΩsrch»
  43.  
  44.